defmodule ProgContest.Fixtures.Contest do
  defmacro __using__(_) do
    quote location: :keep do
      alias ProgContest.Contests

      @valid_contest_attrs %{end_at: "2010-04-17T14:00:00Z", name: "some name", start_at: "2010-04-17T14:00:00Z"}
      @update_contest_attrs %{end_at: "2011-05-18T15:01:01Z", name: "some updated name", start_at: "2011-05-18T15:01:01Z"}
      @invalid_contest_attrs %{end_at: nil, name: nil, start_at: nil}

      def contest_fixture(attrs \\ %{}) do
        {:ok, contest} =
          attrs
          |> Enum.into(@valid_contest_attrs)
          |> Contests.create_contest()

        contest
      end
    end
  end
end
